Skip to content

Sync typeshed - #21799

Merged
JelleZijlstra merged 12 commits into
python:masterfrom
cdce8p:sync-typeshed
Aug 3, 2026
Merged

Sync typeshed#21799
JelleZijlstra merged 12 commits into
python:masterfrom
cdce8p:sync-typeshed

Conversation

@cdce8p

@cdce8p cdce8p commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Source commit:
python/typeshed@7ee1807

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

cdce8p and others added 12 commits August 3, 2026 01:32
This is allegedly causing large performance problems, see 13821

typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing
to undo. Patching this in typeshed also feels weird, since there's a
more general soundness issue. If a typevar has a bound or constraint, we
might not want to solve it to a Literal.

If we can confirm the performance regression or fix the unsoundness
within mypy, I might pursue upstreaming this in typeshed.

(Reminder: add this to the sync_typeshed script once merged)
The plugin provides superior type checking:
python#13987 (comment)
A manual cherry-pick of e437cdf.
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/worker.py:253:9: error: function asyncio.events.set_event_loop_policy is deprecated: Deprecated since Python 3.14; will be removed in Python 3.16.  [deprecated]
+ aiohttp/worker.py:253:9: error: function asyncio.events.set_event_loop_policy is deprecated: Deprecated; will be removed in Python 3.16.  [deprecated]

comtypes (https://github.com/enthought/comtypes)
- comtypes/server/register.py:226: error: Incompatible types in assignment (expression has type "Iterator[tuple[int, str]]", variable has type "list[tuple[int, str]]")  [assignment]
+ comtypes/server/register.py:226: error: Incompatible types in assignment (expression has type "reversed[tuple[int, str]]", variable has type "list[tuple[int, str]]")  [assignment]

discord.py (https://github.com/Rapptz/discord.py)
- discord/abc.py:1815: error: Incompatible types in assignment (expression has type "Iterator[MessagePin]", variable has type "list[MessagePin]")  [assignment]
+ discord/abc.py:1815: error: Incompatible types in assignment (expression has type "reversed[MessagePin]", variable has type "list[MessagePin]")  [assignment]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/monkeypatch.py:417: error: Unused "type: ignore" comment  [unused-ignore]
+ src/_pytest/monkeypatch.py:422: error: Unused "type: ignore" comment  [unused-ignore]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/utils.py:570: error: Returning Any from function declared to return "Iterator[Any]"  [no-any-return]

@cdce8p

cdce8p commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

Mypy primer hits

@JelleZijlstra
JelleZijlstra merged commit f709fc1 into python:master Aug 3, 2026
25 checks passed
@cdce8p
cdce8p deleted the sync-typeshed branch August 3, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants